/**
 * flex 规则【阿里小程序适配】
 */
import { JUSTIFY_CONTENT_STR, ALIGN_ITEMS_STR } from '../constant';

export default {
    regExp: new RegExp(`^flex-(?<justify>${JUSTIFY_CONTENT_STR})-(?<align>${ALIGN_ITEMS_STR})$`),
    render: function ({ grops }) {
        let { justify, align} = grops;
        if (justify === 'between') {
            justify = 'space-between';
        }

        if (justify === 'around') {
            justify = 'space-around';
        }

        if (justify === 'evenly') {
            justify = 'space-evenly';
        }

        return {
            name: 'justifyJustAli',
            css: ['display: flex', `justify-content: ${justify}`, `align-items: ${align}`]
        }
    }
}